﻿/*
 * TiffPixelFormat
 * 
 * initial implementation : 20.10.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */
using System;


namespace Petra.Gis.ImagingServices.Tiff
{
  /// <summary>
  /// similar to System.Windows.Media.PixelFormat but with wider pixel format support
  /// tiff image in full implementation can support many various pixel (sample) formats
  /// in various configuration. For mapping tiff PixelFormat to System.Windows.Media.PixelFormat
  /// please use TiffMetadata.MapPixelFormat() function
  /// </summary>
  public struct TiffPixelFormat
  {
    public readonly int BitsPerPixel;
    //int Mask;
    private readonly string _name;


    public TiffPixelFormat(string name, int bpp)
    {
      if (!(bpp > 0 || bpp < 96))
        throw new ArgumentException("invalid value for BitsPerPixel");

      BitsPerPixel = bpp;
      _name = name;

    }




    public static bool operator ==(TiffPixelFormat left, TiffPixelFormat right)
    {
      return left.BitsPerPixel == right.BitsPerPixel &&
        left._name == right._name;
    }





    public static bool operator !=(TiffPixelFormat left, TiffPixelFormat right)
    {
      return !(left.BitsPerPixel == right.BitsPerPixel &&
        left._name == right._name);
    }





    public override int GetHashCode()
    {
      return base.GetHashCode();
    }





    public override bool Equals(object obj)
    {
      return base.Equals(obj);
    }





    public override string ToString()
    {
      return _name;
    }


  }
}
